home *** CD-ROM | disk | FTP | other *** search
- /************************************************************
- *
- *
- * Unit containing object code access functions.
- *
- * by Adrian Bool in cooperation with Graham Cox.
- *
- * copyright © phantasm coding 1992.
- *
- *
- ************************************************************/
-
- #include "Global.h"
- #include "Object.h"
-
- #include "Object.proto.h"
-
- oHandle newObject(void)
- {
- oHandle temp;
-
- temp = (oHandle) NewHandle(sizeof(object));
-
- if (temp != nil)
- {
- (*temp)->version = 1;
- (*temp)->startAddress = 0;
- (*temp)->size = 0;
- (*temp)->storage = nil;
- (*temp)->position = 0;
- }
- return(temp);
- }
-
- void disposeObject(oHandle theObject)
- {
- if (theObject != nil)
- {
- if ((*theObject)->storage != nil)
- DisposHandle((Handle) (*theObject)->storage);
-
- DisposHandle((Handle) theObject);
- }
- }
-
- void createObjectSpace(oHandle theObject)
- {
- if (theObject != nil)
- (*theObject)->storage = (oStHandle) NewHandle(sizeof(wordType)*(*theObject)->size);
- else
- AsmError = NotEnoughMemory;
- }
-
- void addBlock(oHandle theObject , rBlock theData , short size)
- {
- short x;
- long offset;
-
- if(size > 255)
- AsmError = BlockTooBig;
- if (size > 0)
- for(x = 0 ; x <= size-1 ; x++)
- {
- offset = ((long) (*theObject)->position ) + x;
- (*(*theObject)->storage)[offset] = theData[x];
- }
- }